<%@ page language="java" contentType="text/html; charset=utf8"
	pageEncoding="utf8"%>
<%
	request.setCharacterEncoding("utf8");
%>
<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf8">
  <title>插入</title>
  	 <link type="text/css" rel="stylesheet" href="css/theme1.css">
</head>
<body>
    
		<h1>书本信息填写</h1>
	    <div class="">
		<form action="mana?action=add" method="POST" onsubmit="return f()">
		<div class="bd">
			<label for="inputBookname">&nbsp;书名&nbsp;</label> 
			<input type=text name="bookname" id="inputBookname" required> 
		</div>
		<div class="bd">
			<label for="inputAuthor">&nbsp;作者&nbsp;</label>
			 <input type=text name="author" id="inputAuthor" required> 
		</div>
		<div class="bd">
			<label for="inputPublisher">出版社</label> 
			<input type=text name="publisher" id="inputPublisher" required> 
		</div>
		<div class="bd">
			<label for="inputAmount">&nbsp;数量&nbsp;</label> 
			<input type=text name="amount" id="inputAmount" required> 
		</div>
		<div class="bd">
			<label for="inputComment">&nbsp;备注&nbsp;</label> 
			<input type=text name="comment" id="inputComment"> 
		</div>
		<div class="bd">
			<label for="inputDate">&nbsp;日期&nbsp;</label> 
			<input type=text name="date" id="inputDate"> 
		</div>

		<button type="submit" name="submit" >提交</button>
	</form>
	</div>
		<script>
	function f(){
		var x=document.getElementById("inputAmount").value;
		if(x==""||isNaN(x))
		{
			alert("数量的值不是数字，请重新输入");
			return false;
		}
	    if (document.getElementById("inputBookname").value.length>50) {
	    	alert("书名长度不能超过10，请重新输入");
	    	return false;
	    }
	    if (document.getElementById("inputAuthor").value.length>20) {
	    	alert("作者长度不能超过20，请重新输入");
	    	return false;
	    }
	    if (document.getElementById("inputPublisher").value.length>30) {
	    	alert("出版社长度不能超过30，请重新输入");
	    	return false;
	    }
	}
	</script>
</body>
</html>